<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title></title>

    <script src="http://localhost:3000/socket.io/socket.io.js"></script>
    <script>
        var socket=io.connect('http://localhost:3000/');
        socket.on('serverEmit',function(data){
            console.log(data);
        })
        function send(){
            socket.emit('addCart','我是客户端的数据');
        }
    </script>
</head>
<body>
<% include public/header.ejs%>
<h2><%=title%></h2>
<button onclick="send()">给服务器发送消息</button>
</body>
</html>